package com.redmoon.dingding.service.client;

import cn.js.fan.util.ErrMsgException;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cloudweb.oa.api.IDdService;
import com.cloudweb.oa.cache.UserCache;
import com.cloudweb.oa.entity.Department;
import com.cloudweb.oa.entity.Role;
import com.cloudweb.oa.entity.User;
import com.cloudweb.oa.exception.ValidateException;
import com.cloudweb.oa.service.*;
import com.cloudweb.oa.utils.SpringUtil;
import com.cloudwebsoft.framework.util.LogUtil;
import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiV2UserGetRequest;
import com.dingtalk.api.response.OapiV2UserGetResponse;
import com.redmoon.dingding.Config;
import com.redmoon.dingding.domain.DdDepartment;
import com.redmoon.dingding.domain.DdUser;
import com.redmoon.dingding.enums.Enum;
import com.redmoon.dingding.service.auth.AuthService;
import com.redmoon.dingding.service.department.DepartmentService;
import com.redmoon.dingding.service.eventchange.EventChangeService;
import com.redmoon.dingding.service.role.RoleService;
import com.redmoon.dingding.service.user.UserService;
import com.redmoon.oa.dept.DeptDb;
import com.redmoon.oa.dept.DeptUserDb;
import com.redmoon.oa.organization.DeptTreeAction;
import com.redmoon.oa.person.UserDb;
import com.redmoon.oa.person.UserSetupDb;
import com.redmoon.oa.sys.DebugUtil;
import com.taobao.api.ApiException;

import java.util.*;

public class DingDingClient {

    /**
     * 获取钉钉用户名密码至OA
     */
    public void syncDingDingToOA() {
        IDdService ddService = SpringUtil.getBean(IDdService.class);
        ddService.syncDingDingToOA();
    }

    /**
     * 同步OA部门和用户至钉钉
     */
    public void syncOAtoDingDing(){
        IDdService ddService = SpringUtil.getBean(IDdService.class);
        ddService.syncOAtoDingDing();
    }

    /**
     * 同步钉钉userId至用户表中dingding
     */
    public static void batchUserAddDingDing() {
        IDdService ddService = SpringUtil.getBean(IDdService.class);
        ddService.batchUserAddDingDing();
    }

}
